﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Shove.Web.UI;

public partial class UserControls_MemberHomeMenu : UCBase
{
    public UserControls_MemberHomeMenu()
    {
        Name = "会员中心首页列表菜单控件";

        swpas = new ShoveWebPartAttribute[11];

        swpas[0] = new ShoveWebPartAttribute_Int("控件的宽度", "1,1000", 180, "控件的宽度");
        swpas[1] = new ShoveWebPartAttribute_Int("导航默认文本行高", "1,299", 28, "导航默认文本行高");
        swpas[2] = new ShoveWebPartAttribute_Int("导航单元格宽度", "1,100", 106, "导航单元格宽度");
        swpas[3] = new ShoveWebPartAttribute_Int("菜单标题行高", "1,600", 26, "菜单标题行高");

        swpas[4] = new ShoveWebPartAttribute_Image("导航文本的背景图片", "", "images/title_bg_1.jpg", "导航文本的背景图片");
        swpas[5] = new ShoveWebPartAttribute_Image("单元格背景图片", "", "images/title_bg_hui.jpg", "单元格背景图片");
        swpas[6] = new ShoveWebPartAttribute_Image("控件背景图片", "", "images/category_bg_2.jpg", "控件背景图片");
        swpas[7] = new ShoveWebPartAttribute_Image("菜单提示小图标", "", "images/point_bg.jpg", "菜单提示小图标");

        swpas[8] = new ShoveWebPartAttribute_Text("菜单标题的CSS样式", "", "black12", "菜单标题的CSS样式");
        swpas[9] = new ShoveWebPartAttribute_Text("导航文本的CSS样式", "", "title14_bai", "导航文本的CSS样式");

        swpas[10] = new ShoveWebPartAttribute_Color("控件边框颜色", "#cccccc", "控件边框颜色");
    }

    private void InitLayOut()
    {
        tabctr.Width = swpAttributes[0];
        tabctr.BgColor = swpAttributes[10];

        //tdsign.Height = swpAttributes[1];
        //tdsign.Width = swpAttributes[2];
        //tdsign.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[4] + "')");
        //tdsign.Attributes.Add("class", swpAttributes[9]);

        tdspace.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[5] + "')");

        tabUserInfo.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[6] + "')");
        Img1.Src = "~/" + swpAttributes[7];
        tdUserInfo.Attributes.Add("class", swpAttributes[8]);
        tdUserInfo.Height = swpAttributes[3];

        tabEditPsw.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[6] + "')");
        Img2.Src = "~/" + swpAttributes[7];
        tdEditPsd.Attributes.Add("class", swpAttributes[8]);
        tdEditPsd.Height = swpAttributes[3];

        tabMyOrder.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[6] + "')");
        Img3.Src = "~/" + swpAttributes[7];
        tdMyOrder.Attributes.Add("class", swpAttributes[8]);
        tdMyOrder.Height = swpAttributes[3];

        tabshoucang.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[6] + "')");
        Img4.Src = "~/" + swpAttributes[7];
        tdshoucang.Attributes.Add("class", swpAttributes[8]);
        tdshoucang.Height = swpAttributes[3];

        tabComment.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[6] + "')");
        Img5.Src = "~/" + swpAttributes[7];
        tdComment.Attributes.Add("class", swpAttributes[8]);
        tdComment.Height = swpAttributes[3];

        tabConsult.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[6] + "')");
        Img6.Src = "~/" + swpAttributes[7];
        tdConsult.Attributes.Add("class", swpAttributes[8]);
        tdConsult.Height = swpAttributes[3];

        tabServer.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[6] + "')");
        Img7.Src = "~/" + swpAttributes[7];
        tabServer.Attributes.Add("class", swpAttributes[8]);
        tabServer.Height = swpAttributes[3];

        tabOut.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url('" + swpAttributes[6] + "')");
        Img8.Src = "~/" + swpAttributes[7];
        tdOut.Attributes.Add("class", swpAttributes[8]);
        tdOut.Height = swpAttributes[3];
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (_Customer == null)
            {
                Response.Redirect("Default.aspx?PN=Login");
            }
        }

        InitLayOut();

        //是否为结算会员
        if (_Customer.CustomerTypeID < 10)
        {
            Panel1.Visible = true;
        }
    }

    protected override void OnLoad(EventArgs e)
    {
        isRequestLogin = true;
        Shove._Web.Session.SetSession(uConst.RequestLoginPage, Request.Url.AbsoluteUri);

        base.OnLoad(e);
    }

    protected void lbExit_Click(object sender, EventArgs e)
    {
        Session.RemoveAll();
        Response.Redirect("Default.aspx");
    }

    protected void lbMyOrder_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx?PN=member_homeOrder");
    }

    protected void lbFavoriteGood_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx?PN=member_homeFavoriteGood");
    }

    protected void lbGoodComment_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx?PN=member_homeComment");
    }

    protected void lbGoodConsult_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx?PN=member_homeConsult");
    }

    protected void lbEditPwd_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx?PN=member_homeEditPassword");
    }

    protected void lbEditCustomer_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx?PN=member_homeEditCustomerInfo");
    }

    protected void lbServerManager_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/_Default.aspx");
    }
}
